﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RRTlnkoolitoetusparingResponse", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RRTlnkoolitoetusparingResponse))]
    public class RRTlnkoolitoetusparingResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRRTlnkoolitoetusparingResponse clazz;
        
        public RRTlnkoolitoetusparingResponseSerializer(IRRTlnkoolitoetusparingResponse clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("pocYldPealdis");
            if (clazz.PocYldPealdis!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocYldPealdis))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocYldPealdis");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocPealdisVanem");
            if (clazz.PocPealdisVanem!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocPealdisVanem))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocPealdisVanem");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocPerenimi");
            if (clazz.PocPerenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocPerenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocPerenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocEesnimi");
            if (clazz.PocEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocIsikuKood");
            if (clazz.PocIsikuKood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocIsikuKood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocIsikuKood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocElukohaAadress");
            if (clazz.PocElukohaAadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocElukohaAadress))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocElukohaAadress");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocKontaktaadress");
            if (clazz.PocKontaktaadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocKontaktaadress))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocKontaktaadress");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocTelefon");
            if (clazz.PocTelefon!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocTelefon))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocTelefon");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocAvalduseTekst");
            if (clazz.PocAvalduseTekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocAvalduseTekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocAvalduseTekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocSaajaKonto");
            if (clazz.PocSaajaKonto!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocSaajaKonto))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocSaajaKonto");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocSaajaEesnimi");
            if (clazz.PocSaajaEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocSaajaEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocSaajaEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocSaajaPerenimi");
            if (clazz.PocSaajaPerenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocSaajaPerenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocSaajaPerenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocSaajaIsikukood");
            if (clazz.PocSaajaIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocSaajaIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocSaajaIsikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocPealdisLaps");
            if (clazz.PocPealdisLaps!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocPealdisLaps))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocPealdisLaps");
            }
            Writer.WriteEndElement();
            if (clazz.PocLapsePerenimi!=null) {
                Writer.WriteStartElement("pocLapsePerenimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocLapsePerenimi))).ToString());
                Writer.WriteEndElement();
            }
            Writer.WriteStartElement("pocLapseEesnimi");
            if (clazz.PocLapseEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocLapseEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocLapseEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocLapseIsikukood");
            if (clazz.PocLapseIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocLapseIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocLapseIsikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocLapseElukohaAadress");
            if (clazz.PocLapseElukohaAadress!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocLapseElukohaAadress))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocLapseElukohaAadress");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocLapseKool");
            if (clazz.PocLapseKool!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocLapseKool))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocLapseKool");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocSalvestaNuppKuva");
            if (clazz.PocSalvestaNuppKuva!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocSalvestaNuppKuva))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocSalvestaNuppKuva");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocTeadeKodanikule");
            if (clazz.PocTeadeKodanikule!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocTeadeKodanikule))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocTeadeKodanikule");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="pocYldPealdis") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocYldPealdis");
                }
                clazz.PocYldPealdis = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocYldPealdis")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocYldPealdis", Reader.LocalName);
            }
            if (Reader.LocalName=="pocPealdisVanem") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocPealdisVanem");
                }
                clazz.PocPealdisVanem = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocPealdisVanem")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocPealdisVanem", Reader.LocalName);
            }
            if (Reader.LocalName=="pocPerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocPerenimi");
                }
                clazz.PocPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocPerenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocPerenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="pocEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocEesnimi");
                }
                clazz.PocEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="pocIsikuKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocIsikuKood");
                }
                clazz.PocIsikuKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocIsikuKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocIsikuKood", Reader.LocalName);
            }
            if (Reader.LocalName=="pocElukohaAadress") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocElukohaAadress");
                }
                clazz.PocElukohaAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocElukohaAadress")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocElukohaAadress", Reader.LocalName);
            }
            if (Reader.LocalName=="pocKontaktaadress") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocKontaktaadress");
                }
                clazz.PocKontaktaadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocKontaktaadress")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocKontaktaadress", Reader.LocalName);
            }
            if (Reader.LocalName=="pocTelefon") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocTelefon");
                }
                clazz.PocTelefon = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocTelefon")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocTelefon", Reader.LocalName);
            }
            if (Reader.LocalName=="pocAvalduseTekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocAvalduseTekst");
                }
                clazz.PocAvalduseTekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocAvalduseTekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocAvalduseTekst", Reader.LocalName);
            }
            if (Reader.LocalName=="pocSaajaKonto") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocSaajaKonto");
                }
                clazz.PocSaajaKonto = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocSaajaKonto")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocSaajaKonto", Reader.LocalName);
            }
            if (Reader.LocalName=="pocSaajaEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocSaajaEesnimi");
                }
                clazz.PocSaajaEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocSaajaEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocSaajaEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="pocSaajaPerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocSaajaPerenimi");
                }
                clazz.PocSaajaPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocSaajaPerenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocSaajaPerenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="pocSaajaIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocSaajaIsikukood");
                }
                clazz.PocSaajaIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocSaajaIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocSaajaIsikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="pocPealdisLaps") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocPealdisLaps");
                }
                clazz.PocPealdisLaps = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocPealdisLaps")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocPealdisLaps", Reader.LocalName);
            }
            if (Reader.LocalName=="pocLapsePerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocLapsePerenimi");
                }
                clazz.PocLapsePerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocLapsePerenimi")).Value;
            }
            if (Reader.LocalName=="pocLapseEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocLapseEesnimi");
                }
                clazz.PocLapseEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocLapseEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocLapseEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="pocLapseIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocLapseIsikukood");
                }
                clazz.PocLapseIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocLapseIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocLapseIsikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="pocLapseElukohaAadress") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocLapseElukohaAadress");
                }
                clazz.PocLapseElukohaAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocLapseElukohaAadress")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocLapseElukohaAadress", Reader.LocalName);
            }
            if (Reader.LocalName=="pocLapseKool") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocLapseKool");
                }
                clazz.PocLapseKool = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocLapseKool")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocLapseKool", Reader.LocalName);
            }
            if (Reader.LocalName=="pocSalvestaNuppKuva") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocSalvestaNuppKuva");
                }
                clazz.PocSalvestaNuppKuva = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocSalvestaNuppKuva")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocSalvestaNuppKuva", Reader.LocalName);
            }
            if (Reader.LocalName=="pocTeadeKodanikule") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RRTlnkoolitoetusparingResponse>pocTeadeKodanikule");
                }
                clazz.PocTeadeKodanikule = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocTeadeKodanikule")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RRTlnkoolitoetusparingResponse>pocTeadeKodanikule", Reader.LocalName);
            }
        }
    }
}
